package com.hs.sfzy.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @description 课程评价实体类
 * @author shanglin
 * @date 2024/10/24 10:53
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Coursemark {

  private Long id;
  private String content;
  private Integer grade;

  @DateTimeFormat(pattern = "yyyy-MM-dd")
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
  private Date createTime;
  private Long userId;
  private Long courseId;
  private Course course;
  private User user;

  public void setGrade(Integer grade) {
    if (grade == null) this.grade = 0;
    else this.grade = grade;
  }


}
